﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta content="" name="description" />
    <meta content="webthemez" name="author" />
    <title>开题报告</title>
	<!-- Bootstrap Styles-->
    <link href="assets/css/bootstrap.css" rel="stylesheet" />
    <link href="assets/css/bootstrap.min.css" rel="stylesheet" media="screen"/>
     <!-- FontAwesome Styles-->
    <link href="assets/css/font-awesome.css" rel="stylesheet" />
	
    <link href="assets/css/select2.min.css" rel="stylesheet" >
	<link href="assets/css/checkbox3.min.css" rel="stylesheet" >
        <!-- Custom Styles-->
    <link href="assets/css/custom-styles.css" rel="stylesheet" />
     <!-- Google Fonts-->
   <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
    <link href="assets/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
</head>
<body>
        <div id="page-wrapper" >
		  <div class="header"> 
                        <h1 class="page-header">
                            开题报告  <small>上传开题报告</small>
                        </h1>
		</div>
		
            <div id="page-inner">


                    <div class="row">
                        <div class="col-xs-12">
                            <div class="panel panel-default">
                                <div class="panel-body">
                                    <form class="form-horizontal" id="form">
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label"><span style="color:red">*</span>当前状态</label>
                                            <div class="col-sm-10">
                                                <div readonly="readonly" class="form-control" id="state"  width="30px"></div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label"><span style="color:red">*</span>老师评语</label>
                                            <div class="col-sm-10">
                                                <div readonly="readonly" class="form-control" id="comment"  width="30px"></div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label"><span style="color:red">*</span>关键词</label>
                                            <div class="col-sm-10">
                                                <input type="keys" class="form-control" id="keys" placeholder="关键词" width="30px">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label"><span style="color:red"> *</span>摘要</label>
                                            <div class="col-sm-10">
                                                <input type="summary" class="form-control" id="summary" placeholder="摘要" width="30px">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label"><span style="color:red"> *</span>参考文献</label>
                                            <div class="col-sm-10">
                                                <input type="references" class="form-control" id="references" placeholder="参考文献" width="30px">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label"><span style="color:red">*</span>上传文件</label>
                                            <div class="col-sm-10">
                                                <input id="revfile" type="file" name="file" id="file" class="input_text80"></input>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-offset-2 col-sm-10">
                                                <input type="button" class="btn btn-default" onclick="update()" value="提交">
                                            </div>
                                        </div>
                                    </form>
                                </div>

                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                       历史文档
                                    </div>
                                    <div class="panel-body">
                                        <div class="table-responsive">
                                            <table class="table table-hover">
                                                <thead>
                                                <tr>
                                                    <th>#</th>
                                                    <th>文档</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="download">
                                                <tr>
                                                    <td>1</td>
                                                    <td>Mark</td>
                                                    <td></td>
                                                </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>

                    </div>
                        </div>
                    </div>
               

			</div>
             <!-- /. PAGE INNER  -->
            </div>
         <!-- /. PAGE WRAPPER  -->
        </div>
     <!-- /. WRAPPER  -->
    <!-- JS Scripts-->
    <!-- jQuery Js -->
    <script src="assets/js/jquery-1.10.2.js"></script>
      <!-- Bootstrap Js -->
    <script src="assets/js/bootstrap.min.js"></script>
    <!-- Metis Menu Js -->
    <script src="assets/js/jquery.metisMenu.js"></script>
	<script src="assets/js/select2.full.min.js"></script>
        <script type="text/javascript" src="assets/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
        <script type="text/javascript" src="assets/js/bootstrap-datetimepicker.fr.js" charset="UTF-8"></script>
	<script type="text/javascript">
	$(document).ready(function() {
	  $(".selectbox").select2();
	});
    $('.form_datetime').datetimepicker({
        //language:  'fr',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1
    });
    $('.form_date').datetimepicker({
        language:  'fr',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0
    });
    $('.form_time').datetimepicker({
        language:  'fr',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 1,
        minView: 0,
        maxView: 1,
        forceParse: 0
    });
	</script>
      <!-- Custom Js -->
    <!--<script src="assets/js/custom-scripts.js"></script>-->
        <script src="assets/js/util.js"></script>
	<script>


        var user= JSON.parse(sessionStorage.getItem("user"));//将json转换为对象
        var pp=getResponse("/proposal/listBySid/"+user.id);
        if(pp==null)
            document.getElementById("state").innerHTML='未提交';
        else{
            document.getElementById("comment").innerHTML=pp.responseJSON.comment;
            document.getElementById("state").innerHTML=pp.responseJSON.state;
        }
        var revFile=pp.responseJSON.prosalFile;
        var tmp='';
        for(var i=0;i<revFile.length;i++){
            if(i%2==0){
                tmp+='<tr class="gradeA odd">';
                tmp+='<td class="sorting_1">'+i+'</td>'
                    +'<td class="sorting_1">'+new Date(revFile[i].uploadTime)+'</td>'
                    +'<td class="center"><a href="'+"http://localhost:8080/user/downFile/"+revFile[i].proposalDoc+'" download>下载</a></td>'
                    +'</tr>';
            }
            else{
                tmp+='<tr class="gradeA even">';
                tmp+='<td class="sorting_1">'+i+'</td>'
                    +'<td class="sorting_1">'+new Date(revFile[i].uploadTime)+'</td>'
                    +'<td class="center"><a href="'+"http://localhost:8080/user/downFile/"+revFile[i].proposalDoc+'" download>下载</a></td>'
                    +'</tr>';
            }
        }
        document.getElementById("download").innerHTML=tmp;
        // document.getElementById("realname").innerHTML=user.realname;
        // document.getElementById("username").innerHTML=user.username;
        function update() {
            console.log(user);
            var id=user.id;
            var name=user.realname;
            var keys=document.getElementById("keys").value;
            var summary=document.getElementById("summary").value;
            var references=document.getElementById("references").value;
            var revfile=document.getElementById("revfile").files[0];


            var formData=new FormData();
            formData.append("summary",summary);
            formData.append("keys",keys);
            formData.append("references",references);
            formData.append("proposalFile",revfile);
            var re=getResponse("/proposal/uploadProposal/"+id,formData,"multipart/form-data")
            console.log(re);
        }


    </script>
		
   
</body>
</html>
